package cn.bone.motan.demo2.config;

import com.weibo.api.motan.config.springsupport.AnnotationBean;
import com.weibo.api.motan.config.springsupport.BasicServiceConfigBean;
import com.weibo.api.motan.config.springsupport.ProtocolConfigBean;
import com.weibo.api.motan.config.springsupport.RegistryConfigBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.ImportResource;

/**
 * Created by MD-01 on 2017/3/9.
 * 使用注解方式失败.改用xml方式
 */
@Configuration
@ImportResource(locations = {"classpath:motan-server.xml"})
public class Config {

    /*@Bean(name="annotationBean")
    public AnnotationBean motanAnnotationBean(){
        AnnotationBean motanAnnotationBean = new AnnotationBean();
        motanAnnotationBean.setPackage("cn.bone.motan.**");
        return motanAnnotationBean;
    }

    @Bean(name="demoMotan")
    public ProtocolConfigBean protocolConfig(){
        ProtocolConfigBean config = new ProtocolConfigBean();
        config.setDefault(true);
        config.setName("motan");
        config.setMaxContentLength(1048576);
        return config;
    }

    @Bean(name="registryConfig")
    public RegistryConfigBean  registryConfig(){
        RegistryConfigBean config = new RegistryConfigBean();
        config.setRegProtocol("consul");
        config.setName("my_consul");
        config.setAddress("127.0.0.1:8500");
        return config;
    }

    @Bean
    public BasicServiceConfigBean basicServiceConfig(){
        BasicServiceConfigBean config = new BasicServiceConfigBean();
        config.setExport("demoMotan:2000");
        config.setGroup("motan-rpc");
        config.setAccessLog(false);
        config.setShareChannel(true);
        config.setModule("motan-rpc");
        config.setApplication("bone");
        config.setRegistry("registryConfig");
        return config;
    }*/
}
